/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.ages.test.fjump2

import com.ages.env.AbstractWorld
import javax.media.opengl.GL
import javax.media.opengl.glu.GLU

class FJumpWorld(player:FJPlayer) extends AbstractWorld{

  def worldDone = false
  override def think() {
    for(a<-actors)
    {
      a.think
    }

    for(i<-0 until actors.length)
      {
        for(j<-i+1 until actors.length)
          {
            val a = actors(i)
            val b = actors(j)
            if(a.collidesWith(b)||b.collidesWith(a))
              {
                a.handleCollision(b)
                b.handleCollision(a)
              }
          }
      }
  }
  override def draw(gl:GL){
    gl.glPushMatrix
    gl.glTranslated(0,-player.getPos.Y,0)
//    gl.glRotated(-player.getPos.Y*2,1,0,0)
    gl.glRotated(player.getPos.X*6,0,1,0)
    val glu = new GLU()
    for(a<-actors)
    {
      a.draw(gl)
    }
    gl.glPopMatrix

  }
}


